package com.kc.lib_base.utils;

import android.content.Context;
import android.util.DisplayMetrics;

/**
 * @author created by kingchao
 * @ClassName ScreenUtils
 * @时间：2021/8/25 9:21
 * @note: 获取屏幕的宽高
 */
public class ScreenUtils {


    /**
     * 获取屏幕宽高
     */

    public static int[] getScreenSize(Context context) {
        DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
        return new int[]{displayMetrics.widthPixels, displayMetrics.heightPixels};
    }

    public static int getScreenWidth(Context context) {
        return getScreenSize(context)[0];
    }

    public static int getScreenHeight(Context context) {
        return getScreenSize(context)[1];
    }


}
